//
//  UIImage+DHNewImage.m
//  精品酒店
//
//  Created by DIANGHONG on 2018/5/7.
//  Copyright © 2018年 DIANGHONG. All rights reserved.
//

#import "UIImage+DHNewImage.h"

@implementation UIImage (DHNewImage)
+ (UIImage *) createNewImage:(UIImage *)image newSize:(CGSize)newSize;
{
     UIGraphicsBeginImageContext(newSize);
     
     [image drawInRect:CGRectMake(0.0f, 0.0f, 22, 22)];
     
     image = UIGraphicsGetImageFromCurrentImageContext();
     
     UIGraphicsEndImageContext();
     
        return image;
     }

+ (UIImage *)imageWithColor:(UIColor *)color rect:(CGRect)rect
{
   // CGRect rect = CGRectMake(0, 0, 1, 1);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [color setFill];
    CGContextFillRect(context, rect);
    UIImage *imgae = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return imgae;
}

+ (UIImage *)dh_setNavImageName:(NSString *)imageName
{
    UIImage *image = [UIImage imageNamed:imageName];
    return [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
@end
